﻿

using System;
using System.Linq;
using System.Xml.Linq;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.Win32; 
namespace System.ServiceManager.Facade
{ 

public class IncidentSettings 
	{
	
		// Prefix For Identifier Property
public string PrefixForIdentifier {get;set;} 
		// Max Attachments Property
public int MaxAttachments {get;set;} 
		// Priority Min Value Property
public int PriorityMinValue {get;set;} 
		// Priority Max Value Property
public int PriorityMaxValue {get;set;} 
		// Data Retention Time Property
public int DataRetentionTime {get;set;} 
		// Data Retention Time Unit Property
public int DataRetentionTimeUnit {get;set;} 
		// Operations Manager Web Console URL Property
public string OperationsManagerWebConsoleURL {get;set;} 
		// Max Attachment Size Property
public int MaxAttachmentSize {get;set;} 
		// Priority Matrix Property
public string PriorityMatrix {get;set;} 
		// Resolution Mappings Property
public string ResolutionMappings {get;set;} 
		// Default Support Group Property
public string DefaultSupportGroup {get;set;} 
		// Display Name Property
public string DisplayName {get;set;} 
		

public int GetPriority(Guid urgency, Guid impact)
{

    var el = XElement.Parse(PriorityMatrix);

    var priority = el.Elements().Where(x => x.Attribute("Id").Value == urgency.ToString()).First().Elements().Where(x => x.Attribute("Id").Value == impact.ToString()).First();

    return int.Parse(priority.Value);

}


	}
}